com.cisco.services.tracing

Class BaseTraceWriter

    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected BaseTraceWriter(int[] traceLevels, java.lang.String name, java.lang.String description)
      BaseTraceWriter with trace levels as passed in traceLevels in the array falling outside the range Trace.LOWEST_LEVEL and Trace.HIGHEST_LEVEl are ignored
      protected BaseTraceWriter(int maxTraceLevel, java.lang.String name, java.lang.String description)
      BaseTraceWriter that traces all levels upto the maxTraceLevel The trace level is maintained in the range [Trace.HIGHEST_LEVEL, Trace.LOWEST_LEVEL ]
      protected BaseTraceWriter(java.lang.String name, java.lang.String description)
      BaseTraceWriter which only traces the lowest level ie severity level, Trace.LOWEST_LEVEL messages
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void close()
      Releases any resources associated by this TraceWriter.
      protected void doClose() 
      protected void doFlush() 
      protected abstract void doPrintln(java.lang.String message, int messageNumber)
      Must be implemented by the various TraceWriters extending BaseTraceWriter to provide the specific tracing functionality
      void flush()
      Forces output of any messages that have been printed using the println method
      java.lang.String getDescription() 
      boolean getEnabled()
      Returns whether the println method will print anything or not.
      java.lang.String getName() 
      int[] getTraceLevels() 
      void println(java.lang.String message, int severity)
      Prints the specified string followed by a carriage return The concrete TraceWriter class will use the severity to block out messages from a particular stream.
      void setTraceLevels(int[] levels)
      set the trace levels that will be traced by this TraceWriter
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BaseTraceWriter

        protected BaseTraceWriter(java.lang.String name,
                       java.lang.String description)
        BaseTraceWriter which only traces the lowest level ie severity level, Trace.LOWEST_LEVEL messages
        Parameters:
        name -
        description -
        See Also:
        Trace
      • BaseTraceWriter

        protected BaseTraceWriter(int maxTraceLevel,
                       java.lang.String name,
                       java.lang.String description)
        BaseTraceWriter that traces all levels upto the maxTraceLevel The trace level is maintained in the range [Trace.HIGHEST_LEVEL, Trace.LOWEST_LEVEL ]
        Parameters:
        maxTraceLevel -
        name -
        description -
        See Also:
        Trace
      • BaseTraceWriter

        protected BaseTraceWriter(int[] traceLevels,
                       java.lang.String name,
                       java.lang.String description)
        BaseTraceWriter with trace levels as passed in traceLevels in the array falling outside the range Trace.LOWEST_LEVEL and Trace.HIGHEST_LEVEl are ignored
        Parameters:
        traceLevels - array of trace levels
        name -
        description -
        See Also:
        Trace
    • Method Detail

      • println

        public final void println(java.lang.String message,
                   int severity)
        Description copied from interface: TraceWriter
        Prints the specified string followed by a carriage return The concrete TraceWriter class will use the severity to block out messages from a particular stream. Each trace writer has a notion of the highest level tarce it traces
        Specified by:
        println in interface TraceWriter
        Parameters:
        message - The string to print
        severity - The severity of the trace.
        See Also:
        Trace
      • doPrintln

        protected abstract void doPrintln(java.lang.String message,
                     int messageNumber)
        Must be implemented by the various TraceWriters extending BaseTraceWriter to provide the specific tracing functionality
      • close

        public final void close()
        Description copied from interface: TraceWriter
        Releases any resources associated by this TraceWriter.
        Specified by:
        close in interface TraceWriter
      • doClose

        protected void doClose()
      • flush

        public final void flush()
        Description copied from interface: TraceWriter
        Forces output of any messages that have been printed using the println method
        Specified by:
        flush in interface TraceWriter
      • doFlush

        protected void doFlush()
      • getEnabled

        public boolean getEnabled()
        Description copied from interface: TraceWriter
        Returns whether the println method will print anything or not. A closed TraceWriter will always return false from this method.
        Specified by:
        getEnabled in interface TraceWriter
        Returns:
        true if this TraceWriter is enabled, false if not
      • getName

        public final java.lang.String getName()
        Specified by:
        getName in interface TraceWriter
        Returns:
        the name of this TraceWriter
      • getDescription

        public final java.lang.String getDescription()
        Specified by:
        getDescription in interface TraceWriter
        Returns:
        a short description of this TraceWriter
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setTraceLevels

        public final void setTraceLevels(int[] levels)
        Description copied from interface: TraceWriter
        set the trace levels that will be traced by this TraceWriter
        Specified by:
        setTraceLevels in interface TraceWriter
        Parameters:
        levels - Array of trace levels
        See Also:
        Trace
      • getTraceLevels

        public final int[] getTraceLevels()
        Specified by:
        getTraceLevels in interface TraceWriter
        Returns:
        the array of trace levels that will be traced by this TraceWriter